package com.bdqn.service.Impl;

import com.bdqn.dao.EmployeeDao;
import com.bdqn.dao.Impl.EmployeeDaoImpl;
import com.bdqn.entity.Calendar.Record;
import com.bdqn.entity.CheckWork;
import com.bdqn.entity.Employee;
import com.bdqn.service.EmployeeService;

import java.util.List;

public class EmployeeServiceImpl implements EmployeeService {
    private EmployeeDao dao = new EmployeeDaoImpl();
    @Override
    public Employee findByIdAndPassword(String empId, String password) {
        return dao.findByIdAndPassword(empId,password);
    }


    @Override
    public CheckWork findCheck(String date, Employee emp) {
        return dao.findCheck(date,emp);
    }

    @Override
    public List<Record> findRecord(String empId, String start, String end) {
        return dao.findRecord(empId,start,end);
    }

    @Override
    public boolean updatePassword(String empId, String oldpassword, String newpassword) {
        if(dao.findByIdAndPassword(empId,oldpassword)==null){
            return false;
        }
        return dao.updatepasswordByNew(empId,newpassword);
    }



}
